package com.app.newiptv.helper;

import com.app.newiptv.bean.ProgramBean;
import com.app.newiptv.bean.RequestDto;
import com.app.newiptv.bean.SitcomInfos;
import com.app.newiptv.bean.details.IndexProgram;
import com.app.newiptv.bean.details.PlayDetailsBean;
import com.app.newiptv.callback.IRequestCallback;
import com.app.newiptv.callback.IRequestLisenter;
import com.app.newiptv.utils.OkGoUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Shinelon on 2017/9/15.
 */

public class SitcomOrderHelper {
    private IRequestCallback callback;
    private List<List<SitcomInfos>> mainChanels;
    private ProgramBean.DataBean detailsBean;

    public SitcomOrderHelper() {
        mainChanels = new ArrayList<>();
    }

    public void setCallback(IRequestCallback callback) {
        this.callback = callback;
    }

    public void loadData(String url) {
        OkGoUtil<ProgramBean.DataBean> okGoUtil = new OkGoUtil<ProgramBean.DataBean>(ProgramBean.DataBean.class, OkGoUtil.TYPE_DATA, new IRequestLisenter() {
            @Override
            public void onSuccessData(RequestDto dto) {
                detailsBean = (ProgramBean.DataBean) dto.getData();
                if (callback != null) {
                    callback.onLoadComplete("", 0, 0, detailsBean);
                }
            }

            @Override
            public void onErrer(int code, String errMsg) {
            }
        });
        okGoUtil.requestPost(url);
    }
}
